/* interface InfoType {
  // 索引签名：可以通过字符串索引，去获取到一个值，也是字符串
  [key: string]: string;
}

function getInfo(): InfoType {
  const abc: any = "haha";
  return abc;
}

const info = getInfo();
const name = info["name"];
console.log(name, info.age, info.address); */

// 案例
interface IColleciton {
  [index: number]: string;
  length: number;
}

function printCollection(collection: IColleciton) {
  for (let i = 0; i < collection.length; i++) {
    const item = collection[i];
    console.log(item.length);
  }
}

const array = ["abc", "cba", "nba"];
const tuple: [string, string] = ["why", "acd"];
printCollection(array);
printCollection(tuple);

export {};
